import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

/**
 * @Title: 三元组排序
 * @Author 贾金博
 * @Package PACKAGE_NAME
 * @Date 2024/3/2 19:15
 * @description:
 */
public class 三元组排序 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<test> lis = new ArrayList<>();
        for(int i = 1; i <= n; ++ i ) {
            test t = new test();
            t.x = sc.nextInt();
            t.y = sc.next();
            t.z = sc.next();
            lis.add(t);
        }

        lis.sort(new Comparator<test>() {
            @Override
            public int compare(test o1, test o2) {
                return o1.x - o2.x;
            }
        });

        for(test t : lis) {
            System.out.println(t.x + " " + t.y + " " + t.z);
        }
    }
}

class test {
    int x;
    String  y; // 这里别用double wc 2.60 输出的时候 是2.6
    String z;
}
